﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HtmlDispatcher
{
    public enum ImageType
    {
        Icon,
        Banner,
        Cover,
        Unknown
    }
    static class ImageUtils
    {   
        public static ImageType GetImageType(string imagePath)
        {
            using (Bitmap bitmap = new Bitmap(imagePath))
            {
                // 获取图片的宽度和高度
                int width = bitmap.Width;
                int height = bitmap.Height;

                // 输出图片的长宽
                //Console.WriteLine($"Width: {width}, Height: {height}");
                if (width == height)
                {
                    if (width <= 50)
                    {
                        return ImageType.Icon;
                    } else
                    {
                        return ImageType.Unknown;
                    }
                } else if (width > height)
                {
                    return ImageType.Banner;
                } else if (height > width)
                {
                    return ImageType.Cover;
                } else
                {
                    return ImageType.Unknown;
                }
            }
        }
    }
}
